#include "stdint.h"
#include "stdio.h"
#include "esp_mac.h"
#include "DevicesUID.h"


char *pcUIDGet(void)
{
    static char cUIDBuff[13] = {0};
    uint8_t ucDatas[6];
    uint8_t i;

    if(cUIDBuff[0] == 0)
    {
        esp_read_mac(ucDatas, ESP_MAC_EFUSE_FACTORY);

        for(i = 0; i < 6; ++i)
        {
            cUIDBuff[i * 2]     = "0123456789ABCDEF"[ucDatas[i] >> 4];
            cUIDBuff[i * 2 + 1] = "0123456789ABCDEF"[ucDatas[i] & 0xF];
        }
    }

    return cUIDBuff;
}
